﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MockObject;
using NUnit.Framework;

namespace MockObject.Test
{
    class Program
    {
        static void Main(string[] args)
        {
        }
    }

    [TestFixture]
    public class AnalyzeTest
    {
        [Test]
        public void Analyze_WebServiceThrowException_SendEmail()
        {
            StubService stubservice = new StubService();
            stubservice.ToThrow = new Exception("Fake exception");

            MockEmailService mockemail = new MockEmailService();

            Analyze program = new Analyze();

			
			
            program.Service = stubservice;
            program.Email = mockemail;

            string shortFileName = "abc.tex";
            program.Test(shortFileName);
            Assert.AreEqual("b",mockemail.To);
            Assert.AreEqual("subject", mockemail.Subject);
            Assert.AreEqual("Fake exception", mockemail.Body);

        }
    }
}
